#!/usr/bin/perl

# Bumps $Rev$ in any changed files...
# This is not ideal, but enough for now.


use strict;
use warnings;

chomp(my $desc = `git describe`) || die $!;

foreach (`git diff --cached --name-status`) {
  my ($mod,$file) = split /\s+/;
  if ($mod =~ /[MA]/) {
    system("/usr/bin/perl","-pi", "-e",'s/\$Rev:[^\$\[\']*\$/\$Rev: '.$desc.'\$/', $file) && die $!;
  }
}
exit 0;
